<?php

namespace Modules\Admin\Http\Requests\Coupon;

use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
use HiCommon\Helper;
class CouponRequest extends FormRequest
{

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'name'=>[
                'required',
                'max:20',
            ],
            'validity_at'=>[
                'required',
                'numeric',
            ],
           
        ];
    }

    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }
    public function messages()
    {
        return [
            'name.required'=>'请输入优惠券名称',
            'name.max'=>'优惠券名称不能超过20字',
            'validity_at.required'=>'请输入有效期天数',
            'validity_at.numeric'=>'有效期天数必须是数值',
        ];
    }
}